import { createRouter, createWebHashHistory } from 'vue-router'

// kaoshi
import Kaoshi1 from '@/views/kaoshi/kaoshi1.vue'
import Kaoshi2 from '@/views/kaoshi/kaoshi2.vue'
import Kaoshi3 from '@/views/kaoshi/kaoshi3.vue'
import Kaoshi4 from '@/views/kaoshi/kaoshi4.vue'
import Kaoshi5 from '@/views/kaoshi/kaoshi5.vue'
import Kaoshi6 from '@/views/kaoshi/kaoshi6.vue'

// studydemo
import Demo1 from '@/views/studydemo/demo1.vue'
import Demo2 from '@/views/studydemo/demo2.vue'
import Demo3 from '@/views/studydemo/demo3.vue'

// wangluo
import wangluoDemo1 from '@/views/wangluo/demo1.vue'
import wangluoDemo2 from '@/views/wangluo/demo2.vue'

// luyou
import luyouDemo1 from '@/views/luyou/demo1.vue'
import luyousonDemo1 from '@/views/luyou/sonluyou/sondemo1.vue'

// elementUIdemo
import elementUIdemo1 from '@/views/elementUI/Demo1.vue'
import elementUISondemo1 from '@/views/elementUI/NavigatorOne/Option1.vue'
import elementUISondemo2 from '@/views/elementUI/NavigatorOne/Option2.vue'
import login from '@/views/demo/login.vue'
import upLoadExampleOne from '@/views/upLoadImg/upLoadExample.vue'

const kaoshi = [
  {
    path: '/kaoshi1',
    name: 'kaoshi1',
    component: Kaoshi1,
    title: '考试1'
  },
  {
    path: '/kaoshi2',
    name: 'kaoshi2',
    component: Kaoshi2,
    title: '考试2'
  },
  {
    path: '/kaoshi3',
    name: 'kaoshi3',
    component: Kaoshi3,
    title: '考试3'
  },
  {
    path: '/kaoshi4',
    name: 'kaoshi4',
    component: Kaoshi4,
    title: '考试4'
  },
  {
    path: '/kaoshi5',
    name: 'kaoshi5',
    component: Kaoshi5,
    title: '考试5'
  },
  {
    path: '/kaoshi6',
    name: 'kaoshi6',
    component: Kaoshi6,
    title: '考试6'
  }
]
const studydemo = [
  {
    path: '/Demo1',
    name: 'Demo1',
    component: Demo1,
    title: 'Demo1'
  },
  {
    path: '/Demo2',
    name: 'Demo2',
    component: Demo2,
    title: 'Demo2'
  },
  {
    path: '/Demo3',
    name: 'Demo3',
    component: Demo3,
    title: 'Demo3'
  }
]
const wangluo = [
  {
    path: '/wangluoDemo1',
    name: 'wangluoDemo1',
    component: wangluoDemo1,
    title: 'wangluoDemo1'
  },
  {
    path: '/wangluoDemo2',
    name: 'wangluoDemo2',
    component: wangluoDemo2,
    title: 'wangluoDemo2'
  }
]
const luyou = [
  {
    path: '/luyouDemo1',
    name: 'luyouDemo1',
    component: luyouDemo1,
    title: 'luyouDemo1',
    children: [
      // params传参
      {
        name: 'luyousonDemo1',
        path: 'luyousonDemo1/:userId/:userName',
        component: luyousonDemo1,
        // 路由props传值
        props: true
      }
      // query传参
      // {
      //   name: 'luyousonDemo1',
      //   path: 'luyousonDemo1',
      //   component: luyousonDemo1,
      // }
    ]
  }
]
const elementUIdemo = [
  {
    path: '/',
    redirect: '/home'
  },

  {
    path: '/login',
    name: 'login',
    component: login,
    title: 'login'
  },
  {
    path: '/elementUIdemo1',
    name: 'elementUIdemo1',
    component: elementUIdemo1,
    title: 'elementUIdemo1',
    children: [
      {
        name: 'userManage',
        path: 'user',
        component: elementUISondemo1,
        meta: { title: '用户管理' }
      },
      {
        name: 'roleManage',
        path: 'role',
        component: elementUISondemo2,
        meta: { title: '角色管理' }
      }
    ]
  }
]

const upLoad = [
  {
    name: 'upLoadExampleOne',
    path: '/upLoadExampleOne',
    component: upLoadExampleOne
  }
]

export const routersList = [
  ...kaoshi,
  ...studydemo,
  ...wangluo,
  ...luyou,
  ...elementUIdemo,
  ...upLoad
]

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL), // history模式
  history: createWebHashHistory(),
  routes: routersList
})

export default router
